import './assets/main.css'
import './assets/styles/responsive.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import ErrorHandlerPlugin from './plugins/errorHandler'

// 导入 Toast 通知插件
import Toast from "vue-toastification";
import "vue-toastification/dist/index.css";

// 创建应用实例
const app = createApp(App)

// 使用Pinia进行状态管理
const pinia = createPinia()
app.use(pinia)

// 使用路由
app.use(router)

// 使用 Toast 通知插件
app.use(Toast, {
  transition: "Vue-Toastification__bounce",
  maxToasts: 5,
  newestOnTop: true,
  position: "top-right",
  timeout: 3000,
  closeOnClick: true,
  pauseOnFocusLoss: true,
  pauseOnHover: true,
  draggable: true,
  showCloseButtonOnHover: false,
  hideProgressBar: false,
  closeButton: "button",
  icon: true
})

// 使用错误处理插件
app.use(ErrorHandlerPlugin, {
  // 配置选项
  showNotification: true,
  onError: (error, instance, info) => {
    // 可以在这里添加自定义错误处理逻辑
    console.log('Custom error handler:', error);
  }
})

// 挂载应用
app.mount('#app')
